import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { AchievementMinorData } from "../data/AchievementMinorData";
import { ObjCreate } from "../../common/ObjCreate";
import { AchievementBonusItemsView } from "./AchievementBonusItemsView";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class AchievementFinishedCellRender
    
    export  class AchievementFinishedCellRender extends CellRenderer
    {
        constructor()
        {
            super();
            this.initStyles();
            this.initView();
            this.mouseEnabled = false;
            this.mouseChildren = true;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=arg1 as AchievementMinorData;
            this._txtName.text = loc1.name + "(" + loc1.achievementLevel.toString() + ")";
            this._txtDesc.text = loc1.desc;
            this._bonus.data = loc1.bonusData;
            if (this._txtDesc.numLines != 1) 
            {
                this._txtDesc.y = 15;
            }
            else 
            {
                this._txtDesc.y = 21;
            }
            if (loc1.bonusData.achievement != 0) 
            {
                this._bonus.x = 344;
            }
            else 
            {
                this._bonus.x = 280;
            }
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("overSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedOverSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedUpSkin", new Object /* flash.display.Bitmap */());
            return;
        }

        /* internal  */initView(): void
        {
            this._txtName = ObjCreate.createGTextField("", 11, 20, 200, 20, this);
            var loc1=this._txtName.defaultTextFormat;
            loc1.size = 14;
            loc1.bold = true;
            loc1.color = 1179409;
            this._txtName.defaultTextFormat = loc1;
            this._txtDesc = ObjCreate.createGTextField("", 165, 15, 110, 40, this);
            this._txtDesc.textColor = 16710657;
            this._txtDesc.multiline = true;
            this._txtDesc.wordWrap = true;
            this._bonus = new AchievementBonusItemsView();
            this._bonus.x = 344;
            this._bonus.y = 6;
            this.addChild(this._bonus);
            this._finishedIcon = GlobalClass.getBitmap(ImagesConst.AchievementFinished);
            this._finishedIcon.x = 469;
            this._finishedIcon.y = 4;
            this.addChild(this._finishedIcon);
            ObjCreate.createBg(0, 0, 546, 1, this, ImagesConst.SplitLine);
            ObjCreate.createBg(0, 58, 546, 1, this, ImagesConst.SplitLine);
            return;
        }

        /* internal */ /* var */_txtName: GTextFiled;

        /* internal */ /* var */_txtDesc: GTextFiled;

        /* internal */ /* var */_bonus: AchievementBonusItemsView;

        /* internal */ /* var */_finishedIcon: Object /* flash.display.Bitmap */;
    }
